<template>
  <div>
    <el-container>
      <el-header>所有保单信息</el-header>
      <el-main>
        <el-table :data="orderslist" border style="width: 100%">
          <el-table-column fixed prop="_id" label="订单编号"> </el-table-column>
          <el-table-column prop="usersId" label="客户"> </el-table-column>
          <el-table-column prop="insuresId" label="保险产品"> </el-table-column>
          <el-table-column prop="amount" label="投保金额"> </el-table-column>
          <el-table-column prop="state" label="订单状态"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-popover placement="right" width="400" trigger="click">
                <p>订单详情</p>
                <hr />
                <div class="orderdetail">
                  <p>
                    <label for="">投保人：{{ scope.row.usersId }}</label>
                    <label for="">投保时间:{{ scope.row.orderTime }}</label>
                  </p>
                  <p>
                    <label for="">投保产品：{{ scope.row.insuresId }}</label>
                    <label for="">保单金额:{{ scope.row.amount }}</label>
                  </p>
                  <p>
                    <label for="">保单状态：{{ scope.row.state }}</label>
                    <label for=""
                      >保障期限:{{ scope.row.insurancePeriod }}</label
                    >
                  </p>
                  <p>
                    <label for="">保单编号：{{ scope.row._id }}</label
                    ><label for="">联系方式：{{ scope.row.phone }}</label>
                  </p>
                  <p>
                    <label for="">是否申请退保：{{ scope.row.isCancel }}</label
                    ><label for="">退保进程：{{ scope.row.cancelState }}</label>
                  </p>
                </div>
                <el-button slot="reference">查看详情</el-button>
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
      </el-main>
      <el-footer>
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[1, 5, 10, 15]"
            :page-size="1"
            layout="total, sizes, prev, pager, next, jumper"
            :total="orderslist.length"
          >
          </el-pagination>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions, mapMutations } = createNamespacedHelpers(
  "orders"
);
export default {
  props:['_id'],
  created() {
    this.searchCancelOrders("");
    this.getAllOrders();
    console.log(this._id)
  },
  computed: {
    ...mapState(["orderslist"]),
  },
  methods: {
    handleClick(row) {},
    handleSizeChange(val) {},
    handleCurrentChange(val) {},
    ...mapActions(["getAllOrders"]),
    ...mapMutations(["searchCancelOrders"]),
  },
  data() {
    return {
      currentPage: 1,
    };
  },
};
</script>

<style>
.el-footer {
  line-height: 60px;
}
.block {
  height: 60px;
  line-height: 60px;
}
.el-main {
  padding: 0px;
}
.el-header,
.el-footer {
  padding: 0 20px;
  line-height: 60px;
}
.cell {
  text-align: center;
}
</style>